(function () {
    //父类
    class Animal {
        name: string;
        constructor(name: string) {
            this.name = name;
        }
        eat() {
            console.log('吃的香');
        }
    }
    class Cat extends Animal {
        age: number;
        /*
            若子类继承父类
            子类的构造函数中必须对父类的构造函数
        */

        constructor(name: string, age: number) {
            super(name);
            this.age = age;
        }
        ming() {
            super.eat()
        }
    }

    let cat = new Cat('猫咪', 3)
    console.log(cat.age);
    console.log(cat.name);
    cat.ming()

})

